#include <stack>

using namespace std;

class CQueue
{
public:
    CQueue()
    {
    }

    void appendTail(int value)
    {
        _s1.push(value);
    }

    int deleteHead()
    {
        if (_s1.empty() && _s2.empty())
        {
            return -1;
        }
        
        int ret;
        if (!_s2.empty())
        {
            ret = _s2.top();
            _s2.pop();
        }
        else
        {
            while (!_s1.empty())
            {
                _s2.push(_s1.top());
                _s1.pop();
            }
            ret = _s2.top();
            _s2.pop();
        }
        return ret;
    }

private:
    stack<int> _s1;
    stack<int> _s2;
};